.class Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;
.super Lcom/burstly/lib/network/request/DefaultRequestCallback;
.source "DownloadTrackingManager.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "RequestCallback"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/burstly/lib/network/request/DefaultRequestCallback",
        "<",
        "Ljava/lang/String;",
        ">;"
    }
.end annotation


# static fields
.field private static final DNL_ERR_DB:Ljava/lang/String; = "DNL_ERR_DB"


# instance fields
.field private final mAppContext:Landroid/content/Context;

.field private final mFileName:Ljava/lang/String;


# direct methods
.method constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .locals 0
    .parameter "appContext"
    .parameter "fileName"

    .prologue
    .line 94
    invoke-direct {p0}, Lcom/burstly/lib/network/request/DefaultRequestCallback;-><init>()V

    .line 95
    iput-object p1, p0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->mAppContext:Landroid/content/Context;

    .line 96
    iput-object p2, p0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->mFileName:Ljava/lang/String;

    .line 97
    return-void
.end method

.method private static writeFile(Ljava/lang/String;Landroid/content/Context;)V
    .locals 5
    .parameter "fileName"
    .parameter "context"

    .prologue
    .line 120
    const/4 v3, 0x0

    :try_start_0
    invoke-virtual {p1, p0, v3}, Landroid/content/Context;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream;

    move-result-object v1

    .line 121
    .local v1, fos:Ljava/io/FileOutputStream;
    new-instance v2, Ljava/io/OutputStreamWriter;

    invoke-direct {v2, v1}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;)V

    .line 122
    .local v2, osw:Ljava/io/OutputStreamWriter;
    invoke-static {}, Ljava/lang/Math;->random()D

    move-result-wide v3

    invoke-static {v3, v4}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V

    .line 123
    invoke-virtual {v2}, Ljava/io/OutputStreamWriter;->flush()V

    .line 124
    invoke-virtual {v2}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    .line 132
    .end local v1           #fos:Ljava/io/FileOutputStream;
    .end local v2           #osw:Ljava/io/OutputStreamWriter;
    :goto_0
    return-void

    .line 126
    :catch_0
    move-exception v0

    .line 127
    .local v0, e1:Ljava/io/FileNotFoundException;
    invoke-static {}, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->access$000()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v3

    sget-object v4, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->TAG:Ljava/lang/String;

    invoke-virtual {v3, v4, v0}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 129
    .end local v0           #e1:Ljava/io/FileNotFoundException;
    :catch_1
    move-exception v0

    .line 130
    .local v0, e1:Ljava/io/IOException;
    invoke-static {}, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->access$000()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v3

    sget-object v4, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->TAG:Ljava/lang/String;

    invoke-virtual {v3, v4, v0}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method


# virtual methods
.method public onNoConnection()V
    .locals 1

    .prologue
    .line 109
    const/4 v0, 0x0

    sput-boolean v0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->sDownloadInProgress:Z

    .line 110
    return-void
.end method

.method public bridge synthetic onSuccessInBackground(Ljava/lang/Object;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 71
    check-cast p1, Ljava/lang/String;

    .end local p1
    invoke-virtual {p0, p1}, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->onSuccessInBackground(Ljava/lang/String;)V

    return-void
.end method

.method public onSuccessInBackground(Ljava/lang/String;)V
    .locals 2
    .parameter "processResult"

    .prologue
    .line 101
    const-string v0, "DNL_ERR_DB"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 102
    iget-object v0, p0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->mFileName:Ljava/lang/String;

    iget-object v1, p0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->mAppContext:Landroid/content/Context;

    invoke-static {v0, v1}, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager$RequestCallback;->writeFile(Ljava/lang/String;Landroid/content/Context;)V

    .line 104
    :cond_0
    const/4 v0, 0x0

    sput-boolean v0, Lcom/burstly/lib/downloadtracker/DownloadTrackingManager;->sDownloadInProgress:Z

    .line 105
    return-void
.end method
